//
//  FriendsCollectionViewCell.m
//  Arts1
//
//  Created by Mac Jc on 15/10/22.
//  Copyright © 2015年 Arts1. All rights reserved.
//

#import "FriendsCollectionViewCell.h"
#import "AllHeader.h"

@implementation FriendsCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //  背景图片
        _mainImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, (SCREEN_WIDTH - 80)/7, (SCREEN_WIDTH - 80)/7)];
        _mainImageView.backgroundColor = kRandomColor;
        _mainImageView.layer.cornerRadius = ((SCREEN_WIDTH - 80)/7) / 2;
        [_mainImageView setContentMode:(UIViewContentModeScaleAspectFill)];
        _mainImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:_mainImageView];
        
        // 中文名称
        _userName = [[UILabel alloc] initWithFrame:CGRectMake(0, _mainImageView.bottom + 2, _mainImageView.width, 13)];
        _userName.font = [UIFont fontWithName:@"PingFangSC-Regular" size:11];
        _userName.text = @"Aggie";
        _userName.textColor = kCustomColor(150, 150, 150, 1);
        [_userName setTextAlignment:NSTextAlignmentCenter];
        [self.contentView addSubview:_userName];
        
    }
    return self;
}

- (void)setModel:(FriendsModel *)model
{
    _model = model;
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:_model.userFace] placeholderImage:nil options:SDWebImageRetryFailed | SDWebImageLowPriority ];
    _userName.text = _model.nickName;
}



@end
